import React, { useEffect, useState } from 'react'
import { Pagination } from 'antd';
import { useTitle, usePage } from '../hooks'

export default function About6() {
    const [pagenum, setPagenum] = useState(1)
    const [pageList, total] = usePage("https://api-hmugo-web.itheima.net/api/public/v1/goods/search", {
        cid: 10,
        pagenum,
        pagesize: 5
    })

    useEffect(() => {

    }, [pagenum])

    console.log(pagenum)
    return (
        <div>
            <ul>
                {
                    pageList.map(item => {
                        return <li key={ item.goods_id }>
                            { item.goods_name }
                        </li>
                    })
                }
            </ul>
            <Pagination onChange={(page, pageSize) => {
                setPagenum(page)
            }} defaultCurrent={1} total={total} />
        </div>
    )
}
